package com.smart.sso.server.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.smart.mvc.model.Pagination;
import com.smart.mvc.service.mybatis.impl.ServiceImpl;
import com.smart.sso.server.dao.RegisterUserDao;
import com.smart.sso.server.model.RegisterUser;
import com.smart.sso.server.service.RegisterUserService;

@Service("registerUserService")
public class RegisterUserServiceImpl extends ServiceImpl<RegisterUserDao, RegisterUser, Integer> implements RegisterUserService {

	@Autowired
	public void setDao(RegisterUserDao dao) {
		this.dao = dao;
	}
	
	@Override
	public void save(RegisterUser registerUser) {
		super.save(registerUser);
	}
	
	public RegisterUser findByAccount(String account) {
		return dao.findByAccount(account);
	}
	
	public Pagination<RegisterUser> findPaginationByAccount(String account, Pagination<RegisterUser> p) {
		dao.findPaginationByAccount(account, p);
		return p;
	}
	
	@Transactional
	public void deleteById(List<Integer> idList) {
		verifyRows(dao.deleteById(idList), idList.size(), "用户数据库删除失败");
	}
	
	public List<RegisterUser> findById(List<Integer> idList) {
		return dao.findById(idList);
	}

}
